package com.ruoyi.controller;


import com.ruoyi.domain.RepositoryInfo;
import com.ruoyi.service.IRepositoryInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;

import java.util.List;


@RestController
@RequestMapping("/webshop/repositoryInfo")
public class RepositoryInfoController extends BaseController
{
    @Autowired
    private IRepositoryInfoService repositoryInfoService;

    /**
     * 获取岗位列表
     */
    @GetMapping("/page")
    public TableDataInfo list(RepositoryInfo repositoryInfo)
    {
        startPage();

        List<RepositoryInfo> list = repositoryInfoService.selectList(repositoryInfo);

        return getDataTable(list);
    }


    /**
     * 根据岗位编号获取详细信息
     */
    @GetMapping(value = "/{repositoryInfoId}")
    public AjaxResult getInfo(@PathVariable Long repositoryInfoId)
    {
        return success(repositoryInfoService.selecById(repositoryInfoId));
    }

    /**
     * 新增岗位
     */

    @PostMapping
    public AjaxResult add(@Validated @RequestBody RepositoryInfo repositoryInfo)
    {
        return toAjax(repositoryInfoService.insertRepositoryInfo(repositoryInfo));
    }

    /**
     * 修改岗位
     */
    @PutMapping
    public AjaxResult edit(@Validated @RequestBody RepositoryInfo repositoryInfo)
    {
        return toAjax(repositoryInfoService.updateRepositoryInfo(repositoryInfo));
    }

    /**
     * 删除岗位
     */
    @DeleteMapping("/{repositoryInfoIds}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(repositoryInfoService.deleteByIds(ids));
    }

}

